package com.ofd.sign.controller;

import com.ofd.sign.domin.EcertLockSignReq;
import com.ofd.sign.domin.EcertSealReq;
import com.ofd.sign.domin.SignRes;
import com.ofd.sign.service.SignService;
import lombok.val;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author wangrenjie
 */
@RestController
@RequestMapping("/api")
public class SignController {


    @Resource
    private SignService signService;

    /**
     * 盖章
     *
     * @return
     */
    @PostMapping("seal")
    public SignRes<Object> seal(@RequestBody @Valid EcertSealReq req) {
        val signRes = signService.seal(req);
        return signRes;
    }

    /**
     * 锁定签名
     *
     * @return
     */
    @PostMapping("lockSign")
    public SignRes<Object> sign(@RequestBody @Valid EcertLockSignReq req) {
        val signRes = signService.lockSign(req);
        return signRes;
    }
}
